<?php
include "functions.php";
include "config.php";
?>
<?
if (isset ($_GET['nama_oleh2'])){
$nama_oleh2=$_GET['nama_oleh2'];
}
if (isset ($_POST['kata'])){
$cari=$_POST['kata'];
}
if (isset ($_GET['limit'])){
$limit=$_GET['limit'];
}
if (isset ($_GET['nmbrg'])){
$offset=$_GET['offset'];
}
else{
?>
<?

$totalquery=mysql_query("select * from produk where nama_oleh2 like '%$cari%' limit 30");

$numrows=mysql_num_rows($totalquery);

//Jumlah data yang ditampilkan per page
$limit=30;
if(empty($offset)){
$offset=0;
}
if($numrows==0){
echo"<script lang=javascript>
		 		window.alert('Maaf, Data Yang Anda Cari Kosong...!!!');
		 		history.back();
		 		</script>";
  			exit;
			}
else
{

//untuk header tabel
?>
<table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
  <tr> 
      
    <td height="32" background="../images/banner_produk"> 
      <div align="center"><font color="#FFFFFF" size="4" face="tahoma">Hasil Pencarian</font></div></td>
    </tr>
  </table>
<table width="95%" align=center>
<?
echo"&nbsp;&nbsp;<font face=tahoma size=2><div align=center>Hasil Pencarian Data '$cari' Sebanyak : $numrows item</div></font>";
	$data="select * from produk  where nama_oleh2 like '%$cari%'  limit $offset,$limit";
	$hasil=mysql_query($data);
	$k=1+$offset;
	while($data=mysql_fetch_array($hasil)){
$detil=$data['detil'];
$detil=substr("$detil",0,100);
$harga=($data['harga']);

if(empty($data['gambar'])){
	$gambar="<img src='no%20image2.jpg'>";
}
else{
	$gambar="<img src='images/gambar_produk/$data[gambar]' width=100 height=100>";
}

echo"
	<tr> 
    <td colspan='4' align='center' valign='middle'>&nbsp;</td>
  </tr>
  <tr> 
    <td width=30 height=32><div align=center><font size=2 face=tahoma><a href='?menu=view_produkdetil&&id_oleh2=$data[id_oleh2]'>$gambar</font></div></td>
    <td width=220><div align=justify><font size=2 face=tahoma>
	<a href=index.php?menu=view_produkdetil&&id_oleh2=$data[id_oleh2]>$data[nama_oleh2]</a>
	</font><br>$detil</div></td>
    <td width=10%><a href='?menu=view_produkdetil&id_oleh2=$data[id_oleh2]'><input type=button name=Submit value=Detil></a></td>
  </tr>
  <tr>
    <td colspan='4' align='center' valign='middle'><hr color=#cccccc width=100%></td>
  </tr>	";	
$k++;
}
}
echo"</table>";
}
echo"</font>";
?>
<P>&nbsp;</p>
